package com.cloud.auth.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import com.cloud.auth.entity.Role;

@Repository
public interface RoleDao extends JpaRepository<Role, Integer>{
	
	@Query(nativeQuery = true,
			value = "Select r.* from user u left join user_role ur on u.id=ur.user_id left join role r on r.id=ur.role_id where u.username=:username")
	List<Role> findRoleByUsername(@Param("username")String username);
}
